import { createRouter, createWebHistory } from 'vue-router';
import UserLogin from '../views/UserLogin.vue';
import UserRegister from '../views/UserRegister.vue';
import Nav from '../views/navView.vue'
import HomeView from '../views/HomeView.vue';
import PestView from '../views/PestView.vue';
import FarmlandView from '../views/FarmlandView.vue';
import WeatherView from '../views/WeatherView.vue';
import SoilView from '../views/SoilView.vue';
import chartView from '@/views/chartView.vue';

const routes = [
  { path: '/login', component: UserLogin },
  { path: '/register', component: UserRegister },
  { path:'/',
    component:Nav,
     children:[
      { path:'',component:HomeView },
      { path:'/pest/:farmland_id',
        component:PestView,
        props: true
      },
      { path:'/farmland/:type',
        component:FarmlandView,
       },
      { path:'weather',component:WeatherView },
      {
          path: '/soil/:farmland_id',
          name: 'soil',
          component: SoilView,
          props: true
        },
      {
        path:'chartView',component:chartView
      }
     ]
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

export default router;